

import 'package:flutter/material.dart';
import 'package:kmxy_base/network/net.dart';
import 'package:kmxy_base/util/event.dart';

class GlobalLogBtn {
  static bool isShowLogBtn = false;

  static OverlayEntry overlayEntry = OverlayEntry(builder: (context) {
    return Positioned(
        top: 30,
        left: 100,
        child: Material(
          child: InkWell(
            onTap: () {
              Event.eventBus.fire(Event(Net.EVENT_NetLogPage, ''));
            },
            child: Container(
              color: Colors.red,
              alignment: Alignment.center,
              width: 40,
              height: 40,
              child: const Text(
                'LOG',
                style: TextStyle(color: Colors.white, fontSize: 18),
              ),
            ),
          ),
        ));
  });

  static void show({required BuildContext context}) {
    Overlay.of(context).insert(overlayEntry);
    isShowLogBtn = true;
  }

  static void dismiss() {
    overlayEntry.remove();
    isShowLogBtn = false;
  }
}
